import { ThreeGeometry } from "../three/geometry";
import { ThreeLoader } from "../three/loader";
import { ThreeMaterial } from "../three/material";
import { ThreeMesh } from "../three/mesh";

export class OutsideMesh {
    private threeLoader = new ThreeLoader();
    private threeGeometry = new ThreeGeometry();
    private threeMesh = new ThreeMesh();
    private threeMaterial = new ThreeMaterial();

    create() {
        const geometry = this.threeGeometry.sphere(500, 60, 60);
        geometry.scale(1, 1, -1);

        const outside_low = this.threeMaterial.meshBasic({
            map: this.threeLoader.texture().load('./assets/images/outside_low.jpg')
        });

        const mesh = this.threeMesh.create(geometry, outside_low);

        this.threeLoader.texture().load('./assets/images/outside.jpg', texture => {
            mesh.material = this.threeMaterial.meshBasic({ map: texture });
        })

        return mesh;
    }
    
}